<?php
$api = app(Dingo\Api\Routing\Router::class);

$api->version('v1', function ($api) {
    $api->group(['namespace' => 'App\Http\Controllers\Api\V1', 'middleware' => ['setting_guard:customer']], function ($api) {
        $api->group(['namespace' => 'Auth', 'prefix' => 'auth', 'as' => 'auth'], function ($api) {
            $api->get('current', 'AuthorizationController@current', ['as' => 'customer.current']);
            $api->post('authorizations', 'AuthorizationController@login');
        });

        $api->group(['namespace' => 'Frontend', 'middleware' => ['jwt.auth', 'setting_guard:customer'], 'prefix' => 'customer', 'as' => 'customer'], function ($api) {
            $api->resource('follow', 'FollowController');
            $api->resource('order', 'OrderController');
            $api->get('payment', 'OrderController@payment');
            $api->resource('info', 'CustomerController');
        });

        $api->group(['namespace' => 'Frontend', 'prefix' => 'frontend', 'as' => 'frontend'], function ($api) {

            $api->get('category', ['uses' => 'CategoryController@index', 'as' => 'category.index']);

            $api->get('about', ['uses' => 'AboutController@index', 'as' => 'about.index']);

            $api->get('video', ['uses' => 'VideoController@index', 'as' => 'video.index']);
            $api->get('video_first', ['uses' => 'VideoController@show', 'as' => 'video.show']);

            $api->get('advertisement', ['uses' => 'AdvertisementController@index', 'as' => 'advertisement.index']);
        });

    });
});
